package order

import (
	"API/client"
	"API/request"
	"API/response"
	"common/utils"
	"github.com/gin-gonic/gin"
	order "order_server/proto"
)

// OrderDetail 获取订单详情
func OrderDetail(c *gin.Context) {
	var req request.OrderInfoRequest
	if err := c.ShouldBind(&req); err != nil {
		response.CurrencyErrResponse(c, 400, err.Error())
		return
	}

	list, err := client.OrderDetail(c, &order.OrderDetailRequest{
		OrderId: req.OrderId,
	})
	if err != nil {
		response.CurrencyErrResponse(c, -1, utils.CutOutRpcError(err.Error()))
		return
	}

	response.CurrencySuccessResponse(c, "订单详情成功", map[string]interface{}{
		"OrderInfo": list,
	})
}
